package com.LeeCode;

/**
 * 装饰树
 */

public class CodeLCP067 {
    public static void main(String[] args) {
        Integer[] arr = {3, 1, 7, 3, 8, null, 4};
        TreeNode root = Utils.buildTree(arr);
        System.out.println(new CodeLCP067().expandBinaryTree(root));
    }

    public TreeNode expandBinaryTree(TreeNode root) {

        if (root.left != null) {
            root.left = new TreeNode(-1, expandBinaryTree(root.left), null);
        }
        if (root.right != null) {
            root.right = new TreeNode(-1, null, expandBinaryTree(root.right));
        }

        return root;
    }
}
